package com.intel.two.controller.smarthome;

import com.intel.two.common.R;
import com.intel.two.exception.CustomerException;
import com.intel.two.pojo.smarthome.Guarantee;
import com.intel.two.service.smarthome.GuaranteeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @BelongsProject: intelligentcommunity
 * @BelongsPackage: com.intel.two.controller.smarthome
 * @Author: yanhongwei
 * @CreateTime: 2022-10-13  16:51
 * @Description: TODO
 * @Version: 1.0
 */

@RestController
@RequestMapping("/guarantee")
public class GuaranteeController {

    @Autowired
    GuaranteeService guaranteeService;

    @GetMapping("/guaranteeList")
    public R  guaranteeList(@RequestParam Map<String, Object> parameters) throws CustomerException {
        return guaranteeService.guaranteeList(parameters);
    }

    @PostMapping("/guaranteeAdd")
    public R  guaranteeAdd(@RequestBody Guarantee guarantee)throws CustomerException{
        return guaranteeService.guaranteeAdd(guarantee);
    }


    @PostMapping("/guaranteeDel")
    public R  guaranteeDel(@RequestBody List<Guarantee> guarantees)throws CustomerException{
        return guaranteeService.guaranteeDel(guarantees);
    }

    @PostMapping("/guaranteeEdit")
    public R  guaranteeEdit(@RequestBody Guarantee guarantee)throws CustomerException{
        return guaranteeService.guaranteeEdit(guarantee);
    }


}
